package com.wc.算法提高课.E第五章_数学知识.容斥原理.Devu和鲜花;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/5 15:29
 * @description https://www.acwing.com/problem/content/description/216/
 */
public class Main {
    /**
     * 隔板法<p>
     * 从n个花瓶里面选m朵花, 每个花瓶中有无数朵花<p>
     * x[1] + x[2] + ... + x[n] = m, x[i] >= 0<p>
     * x[1] + 1 + x[2] + 1 + ... + x[n] + 1 = m + n<p>
     * y[1] + y[2] + ... + y[n] = m + n, y[i] >= 1<p>
     * 可以使用隔板法计算出方案数, 一共有 m + n - 1个空隙, 插入 n - 1块板子, 来形成 n 个瓶子中的花<p>
     * ans = C(n + m - 1, n - 1), C(n, m) 代表从 n 中 选出 m 个的组合数<p>
     * 思路:<p>
     * 根据上述隔板法来推算这个题, 是有限制的<p>
     * 0 <= x[i] <= A[i],那么我们只需要容斥原理<p>
     * 总共是C(N + M - 1, N - 1)种方案 - 违反限制的方案数<p>
     * S[i] 表示 违反第 i 个花瓶的方案数, 违反也就是从其中选出A[i] + 1朵花<p>
     * 等价于从N个花瓶中 选 M - (A[i] + 1), 根据隔板法也就是C(n + m - 1 - (A[i] + 1), n - 1)<p>
     * 但是有容斥原理, 如果第一个第二个都不满足奇不满足就是减偶数个不满足就是加<p>
     * ans = C(n + m - 1, n - 1) - /sum_1_n C(n + m - 1 - (A[i] + 1), n - 1) + /sum_i_j C(n + m - 1 - (A[i] + 1) - (A[j] + 1), n - 1) + ...
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 20, P = (int) 1e9 + 7;
    static long[] A = new long[N];
    static long down = 1, n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextLong();
        for (int i = 0; i < n; i++) A[i] = sc.nextLong();
        long res = 0;
        for (long i = 1; i <= n - 1; i++) down = i * down % P;
        down = qmi(down, P - 2);

        // 用二进制计算, 是1的就是违反规定的
        for (int i = 0; i < 1 << n; i++) {
            int sign = 1;
            long a = m + n - 1, b = n - 1;
            for (int j = 0; j < n; j++) {
                if ((i >> j & 1) == 1) {
                    sign = -sign;
                    a -= A[j] + 1;
                }
            }
            res = (res + C(a, b) * sign) % P;
        }
        out.println((res + P) % P);
        out.flush();
    }

    static long C(long a, long b) {
        if (a < b) return 0;
        long up = 1;
        for (long i = a; i > a - b; i--) up = i % P * up % P;
        // 逆元
        return up * down % P;
    }

    static long qmi(long a, long b) {
        long res = 1;
        a %= P;
        while (b > 0) {
            if ((b & 1) == 1) res = res * a % P;
            a = a * a % P;
            b >>= 1;
        }
        return res;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
